package aad.storyboard.model;

import java.io.FileNotFoundException;

import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.view.View;

public class DropSpot extends GraphicalObject{

	
	private DropListener listener;	
	private Boolean dimansionsCalculated;
	int left, top, width, height;
	private float radius=22;
	
	public DropSpot(DropListener listener) {
		super();
		this.listener = listener;
		dimansionsCalculated = false;
	}

		
	public Boolean isOver(int x, int y) {
		if (!dimansionsCalculated) 
			calculateDimensions();
		boolean isOver=false;
		
		int centerX = getPosX() + 25;
		int centerY = getPosY() + 25;
		
		// calculate the radius from the touch to the center of the img
		double radCircle  = Math.sqrt( (double) (((centerX-x)*(centerX-x)) + (centerY-y)*(centerY-y)));
		
		// if the radius is smaller then 23 (radius of a ball is 22), then it must be on the ball
		if (radCircle < 23){
			isOver=true;
		}

		return isOver;
	}
		
	public DropListener getListener() {
		return listener;
	}
	
	private void calculateDimensions() {				
					
        left=this.getPosX();
        top=this.getPosY();
        height=this.getHeight();
        width=this.getWidth();

	}



	public int getHeight() {
		// TODO Auto-generated method stub
		return height;
	}


	public int getWidth() {
		// TODO Auto-generated method stub
		return width;
	}

	
	
	public float getRadius() {
		
		return radius;
	}


	
}

